package com.kantboot.system.user.service;

import com.kantboot.system.user.domain.dto.BalanceAddDTO;
import com.kantboot.system.user.domain.entity.SysBalanceChangeRecord;
import com.kantboot.system.user.domain.entity.SysUserBalance;

import java.math.BigDecimal;
import java.util.Map;

public interface ISysUserBalanceService {

    /**
     * 根据用户id增加余额
     * @param dto 余额增加参数
     * @return 增加后的余额
     */
    SysBalanceChangeRecord changeBalance(BalanceAddDTO dto);

    /**
     * 余额变化,内部调用
     * 该方法在BalanceChangeListener中调用
     */
    void changeBalanceInner(SysBalanceChangeRecord record,boolean isRetry);

    void changeBalanceInnerRetry(SysBalanceChangeRecord record);

    SysUserBalance getBalanceByCodeAndUserId(String code, Long selfId);

    SysUserBalance getBalanceSelfByCode(String code);

    Map<String, BigDecimal> getBalanceMapByUserId(Long userId);

    Map<String, BigDecimal> getBalanceSelfMap();
}
